
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author BENSON
 */
public class ControllerHomePage {
     public HomePage home;
    private ActionListener actionListener;
    
    
    EnterForm addOrder= new EnterForm();
    ListOrders listOrder= new ListOrders();
    DeleteOrder deleteOrder=new DeleteOrder();
   // ModifyOrder modifyOrder=new ModifyOrder();
    EnterFlight enterFlight= new EnterFlight();
    ModifyFlight modifyFlight=new ModifyFlight();
    DeleteFlight deleteFlight = new DeleteFlight();
    ListFlights listFlight = new ListFlights();
    EnterEmployee addEmployee = new EnterEmployee();
    ListEmployees listEmployee = new ListEmployees();
    ModifyEmployee modifyEmployee = new ModifyEmployee();
    DeleteEmployee deleteEmployee= new DeleteEmployee();
    
    public ControllerHomePage( ){
        home = new HomePage();
        home.setVisible(true);
    }
    public void contol(){        
        actionListener = new ActionListener() {
              public void actionPerformed(ActionEvent actionEvent) { 
                  if(actionEvent.getSource()==home.getAddEmp()){ 
                      ControllerAddEmp add= new ControllerAddEmp();
                         add.contol();
                  }
                  if(actionEvent.getSource()==home.getModifyEmp()){
                       modifyEmployee.setVisible(true); 
                  }
                  if(actionEvent.getSource()==home.getDeleteEmp()){
                      ControllerDeleteEmp delete= new ControllerDeleteEmp();
                        delete.contol();
                  }
                  if(actionEvent.getSource()==home.getShowEmp()){
                      ControllerListEmp cE= new ControllerListEmp();
                        cE.contol();
                  }
                  if(actionEvent.getSource()==home.getAddFlight()){  
                      ControllerAddFlight c= new ControllerAddFlight();
                     c.contol();
                  }
                  if(actionEvent.getSource()==home.getModifyFlight()){
                       modifyFlight.setVisible(true);
                  }
                  if(actionEvent.getSource()==home.getDeleteFlight()){
                      ControllerDeleteFlight deleteF= new ControllerDeleteFlight();
                        deleteF.contol();
                  }
                  if(actionEvent.getSource()==home.getShowFlight()){
                      ControllerListFlight cF= new ControllerListFlight();
                        cF.contol();
                  }
                  if(actionEvent.getSource()==home.getAddReservation()){
                      ControllerAddOrder Ao= new ControllerAddOrder();
                      Ao.contol();
                      Ao.contolCombo();
                  }
                  if(actionEvent.getSource()==home.getModifyReservation()){
                       //modifyOrder.setVisible(true);
                  }
                  if(actionEvent.getSource()==home.getDeleteReservation()){
                      DeleteOrderController deleteO= new DeleteOrderController();
                        deleteO.contol();
                  }
                  if(actionEvent.getSource()==home.getShowReservation()){
                      ControllerListOrders cLO= new ControllerListOrders();
                         cLO.contol();
                  }
                                    
                   if(actionEvent.getSource()==home.getAddEmMenu()){ 
                      ControllerAddEmp add= new ControllerAddEmp();
                         add.contol();
                  }
                  if(actionEvent.getSource()==home.getModifyEmMenu()){
                       modifyEmployee.setVisible(true); 
                  }
                  if(actionEvent.getSource()==home.getDeleteEmMenu()){
                      ControllerDeleteEmp delete= new ControllerDeleteEmp();
                        delete.contol();
                  }
                  if(actionEvent.getSource()==home.getShowEmMenu()){
                      ControllerListEmp cE= new ControllerListEmp();
                        cE.contol();
                  }
                  if(actionEvent.getSource()==home.getAddFlMenu()){  
                      ControllerAddFlight c= new ControllerAddFlight();
                     c.contol();
                  }
                  if(actionEvent.getSource()==home.getModifyFlMenu()){
                       modifyFlight.setVisible(true);
                  }
                  if(actionEvent.getSource()==home.getDeleteFlMenu()){
                      ControllerDeleteFlight deleteF= new ControllerDeleteFlight();
                        deleteF.contol();
                  }
                  if(actionEvent.getSource()==home.getShowFlMenu()){
                      ControllerListFlight cF= new ControllerListFlight();
                        cF.contol();
                  }
                  if(actionEvent.getSource()==home.getAddReMenu()){
                      ControllerAddOrder Ao= new ControllerAddOrder();
                      Ao.contol();
                      Ao.contolCombo();
                  }
                  if(actionEvent.getSource()==home.getModifyReMenu()){
                    //   modifyOrder.setVisible(true);
                  }
                  if(actionEvent.getSource()==home.getDeleteReMenu()){
                      DeleteOrderController deleteO= new DeleteOrderController();
                        deleteO.contol();
                  }
                  if(actionEvent.getSource()==home.getShowReMenu()){
                      ControllerListOrders cLO= new ControllerListOrders();
                         cLO.contol();
                  }
                  
                  }
              
        };
        //Buttons ActionListener
        home.getAddEmp().addActionListener(actionListener);
        home.getModifyEmp().addActionListener(actionListener);
        home.getDeleteEmp().addActionListener(actionListener);
        home.getShowEmp().addActionListener(actionListener);
        home.getAddFlight().addActionListener(actionListener);
        home.getModifyFlight().addActionListener(actionListener);
        home.getDeleteFlight().addActionListener(actionListener);
        home.getShowFlight().addActionListener(actionListener);
        home.getAddReservation().addActionListener(actionListener);
        home.getModifyReservation().addActionListener(actionListener);
        home.getDeleteReservation().addActionListener(actionListener);
        home.getShowReservation().addActionListener(actionListener);
       
    //MenuItems Action listener
        home.getAddEmMenu().addActionListener(actionListener);
        home.getModifyEmMenu().addActionListener(actionListener);
        home.getDeleteEmMenu().addActionListener(actionListener);
        home.getShowEmMenu().addActionListener(actionListener);
        home.getAddFlMenu().addActionListener(actionListener);
        home.getModifyFlMenu().addActionListener(actionListener);
        home.getDeleteFlMenu().addActionListener(actionListener);
        home.getShowFlMenu().addActionListener(actionListener);
        home.getAddReMenu().addActionListener(actionListener);
        home.getModifyReMenu().addActionListener(actionListener);
        home.getDeleteReMenu().addActionListener(actionListener);
        home.getShowReMenu().addActionListener(actionListener);
        }
     
}
